// Mock数据 - 用于在后端API不可用时提供数据
export const mockData = {
  // 日销售统计
  dailySales: {
    code: 200,
    data: {
      total_amount: 28500.50,
      total_orders: 45,
      avg_order_amount: 633.34
    }
  },
  
  // 周销售统计
  weeklySales: {
    code: 200,
    data: {
      total_amount: 198500.75,
      total_orders: 312,
      avg_order_amount: 636.22
    }
  },
  
  // 月销售统计
  monthlySales: {
    code: 200,
    data: {
      total_amount: 856000.25,
      total_orders: 1245,
      avg_order_amount: 687.55
    }
  },
  
  // 综合统计
  comprehensiveStats: {
    code: 200,
    data: {
      total_products: 1234,
      total_customers: 5678,
      total_orders: 9876
    }
  },
  
  // 热销商品排行
  topProducts: {
    code: 200,
    data: [
      {
        product_name: 'iPhone 15 Pro',
        sales_quantity: 156,
        sales_amount: 156000,
        percentage: 0.25
      },
      {
        product_name: 'MacBook Pro M3',
        sales_quantity: 89,
        sales_amount: 178000,
        percentage: 0.18
      },
      {
        product_name: 'iPad Air',
        sales_quantity: 134,
        sales_amount: 80400,
        percentage: 0.15
      },
      {
        product_name: 'Apple Watch S9',
        sales_quantity: 203,
        sales_amount: 81200,
        percentage: 0.12
      },
      {
        product_name: 'AirPods Pro 2',
        sales_quantity: 267,
        sales_amount: 53400,
        percentage: 0.10
      },
      {
        product_name: 'Nike Air Max',
        sales_quantity: 145,
        sales_amount: 21750,
        percentage: 0.08
      },
      {
        product_name: '茅台酒',
        sales_quantity: 23,
        sales_amount: 69000,
        percentage: 0.06
      },
      {
        product_name: '华为P60',
        sales_quantity: 78,
        sales_amount: 46800,
        percentage: 0.04
      }
    ]
  },
  
  // 销售曲线数据
  salesCurve: {
    code: 200,
    data: generateSalesCurveData(30)
  }
}

// 生成销售曲线模拟数据
function generateSalesCurveData(days) {
  const data = []
  const now = new Date()
  
  for (let i = days - 1; i >= 0; i--) {
    const date = new Date(now.getTime() - i * 24 * 60 * 60 * 1000)
    const dateStr = date.toISOString().split('T')[0]
    const baseAmount = 15000 + Math.sin((days - i) * 0.1) * 5000
    const amount = Math.floor(baseAmount + Math.random() * 10000)
    const orders = Math.floor(amount / 500 + Math.random() * 20)
    
    data.push({
      date: dateStr,
      total_amount: amount,
      total_orders: orders
    })
  }
  
  return data
}

// 原始仪表盘数据
export const mockDashboardData = {
  overview: {
    code: 200,
    data: {
      todaySales: 28500,
      yesterdaySales: 25600,
      todayOrders: 45,
      yesterdayOrders: 42,
      todayMembers: 18,
      yesterdayMembers: 15,
      conversion: 3.2,
      yesterdayConversion: 2.8
    }
  },
  
  salesTrend: {
    code: 200,
    data: {
      dates: ['01-10', '01-11', '01-12', '01-13', '01-14', '01-15', '01-16'],
      sales: [15000, 18000, 22000, 19000, 25000, 28000, 31000],
      orders: [25, 32, 38, 35, 42, 45, 48]
    }
  },
  
  salesComposition: {
    code: 200,
    data: [
      { name: '电子产品', value: 35 },
      { name: '服装鞋包', value: 25 },
      { name: '食品饮料', value: 20 },
      { name: '家居用品', value: 12 },
      { name: '其他', value: 8 }
    ]
  },
  
  productRank: {
    code: 200,
    data: [
      { name: 'iPhone 15', value: 150 },
      { name: 'MacBook Pro', value: 120 },
      { name: 'iPad Air', value: 100 },
      { name: 'Apple Watch', value: 80 },
      { name: 'AirPods Pro', value: 60 }
    ]
  },
  
  salespersonRank: {
    code: 200,
    data: [
      { name: '张三', sales: 50000, orders: 25 },
      { name: '李四', sales: 45000, orders: 22 },
      { name: '王五', sales: 40000, orders: 20 },
      { name: '赵六', sales: 35000, orders: 18 },
      { name: '钱七', sales: 30000, orders: 15 }
    ]
  }
} 